import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue';
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
// 下载node声明模块：pnpm i @types/node -D
import path from "path";

// https://vite.dev/config/
export default defineConfig({
    plugins: [
        vue(),
        AutoImport({
            resolvers: [ElementPlusResolver()],
        }),
        Components({
            resolvers: [ElementPlusResolver()],
        }),
    ],
    server:{
        open:true,
        host:"zhangpeiyue.com",
        port:80,
        proxy:{
            "/yuma":{
                target:"http://zhangpeiyue.com:8888",
                changeOrigin:true,
                rewrite:path=>path.replace(/^\/yuma/,"")
            }
        }
    },
    // 模块解析
    resolve:{
        // 配置别名
        alias:{
            "@":path.resolve(__dirname,"./src")
        }
    }
})
